import { resultPageDataInt } from '@/types/common'
import {
  loginQueryInt,
  loginDataInt,
  userInfoType,
  userListParamsInt,
  userListItemInt
} from '@/types/user'
import { request } from '@/utils/request'

// 登录
export function postLogin(data: loginQueryInt) {
  return request<loginDataInt>({
    url: '/v1/login',
    method: 'post',
    data
  })
}
// 获取用户信息
export function getUserInfo(token: string) {
  return request<userInfoType>({
    url: '/v1/getUserInfo',
    method: 'get',
    params: {
      token
    }
  })
}

// 获取用户列表
export function getUserList(params: userListParamsInt) {
  return request<resultPageDataInt<userListItemInt>>({
    url: `/admin/acl/user/${params.page}/${params.limit}`,
    method: 'get',
    params
  })
}
